package com.kamistoat.meimeimall.common.exception;

import java.util.HashMap;
import java.util.Map;

/**
 * 自定义异常
 */
public class RRException extends RuntimeException {
    private static final long serialVersionUID = 1L;

    private String msg;
    private int code = 500;
    private Map<String, Object> map;


    public RRException(String msg) {
        super(msg);
        this.msg = msg;
        this.map = new HashMap<>();
    }

    public RRException(String msg, Throwable e) {
        super(msg, e);
        this.msg = msg;
        this.map = new HashMap<>();
    }

    public RRException(String msg, int code) {
        super(msg);
        this.msg = msg;
        this.code = code;
        this.map = new HashMap<>();
    }

    public RRException(String msg, int code, Throwable e) {
        super(msg, e);
        this.msg = msg;
        this.code = code;
        this.map = new HashMap<>();
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public void put(String key, Object value) {
        this.map.put(key,value);
    }
    public Object get(String key){
        return this.map.get(key);
    }
}
